/**
 * 
 */
package com.fox.webapp.persistent;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.fox.webapp.domain.LoginLog;

/**
 * @author Yockii
 *
 */
public interface LoginLogRepository extends PagingAndSortingRepository<LoginLog, ObjectId> {

	Page<LoginLog> findByUsername(String username, Pageable pageRequest);

	@Query(fields = "{'username':1, 'ipAddr':1}")
	List<LoginLog> findDistinctLoginLogByIpAddr(String ipAddr);
	
}
